﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace iCollect.CollectDetail
{
    public partial class UserAdmin : UserControl
    {
        public UserAdmin()
        {
            InitializeComponent();
        }

        private void adminLoad(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“cUPDataDataSet.device”中。您可以根据需要移动或移除它。
            this.userTableAdapter1.Fill(this.cupRepositoryDataSet1.user);

        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (!cupRepositoryDataSet1.HasChanges())
            {
                return;
            }
            try
            {
                userBindingSource.EndEdit();
                userTableAdapter1.Update(this.cupRepositoryDataSet1.user);
                this.cupRepositoryDataSet1.AcceptChanges();
                //endEditData();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("Update failed:" + ex.Message);

            }
        }

        private void endEditData()
        {
            dataGridView1.ReadOnly = true;
            this.bindingNavigatorAddNewItem.Enabled = false;
            this.bindingNavigatorDeleteItem.Enabled = false;
        }

        
    }
}
